// first test ...

#include <stdio.h>
#include <tchar.h>
#include <iostream>
#include <string>

#include <windows.h>

#include "global_defs.h"

#include "MemoryDefs.h"
#include "MemoryDefs_impl.h"

#include "CLog.h"
#include "ISystem.h"
#include "CVector.h"

#include "CMetaClass.h"

#ifndef GS_LIB
	static SSystemGlobalEnvironment * gEnv;
#endif

int _tmain(int argc, _TCHAR* argv[])
{
	LOG_BEGIN;

	LOG("testing syste. get ISystem");

	ISystem * pSystem = getSystemInterface();

	pSystem->init();

	gEnv = pSystem->getSystemGlobalEnvironment();

	pSystem->sysMemInfo();

	
	LOG("CVec3 section begin");

	CVec3 vec;

	vec.toYaw();

	LOG("CVec3 section end");

	LOG("csys test");

	pSystem->testMem();

	LOG("csys end test");

	LOG("new\\delete test");

	void * mp = (void *) new char(123);

	delete[] mp;

	LOG("new\\delte test end");
	
	void * p = pSystem->sysAlloc(16);

	LOG("p: '" << (PRO::int32_t)(((char *)p)[0]) << "'");

	pSystem->sysMemInfo();

	size_t size = pSystem->sysFree(p);

	LOG("size: '" << ((PRO::uint32_t)size) << "'");

	pSystem->sysMemInfo();

	p = Mem_Alloc(1024*1024*10);

	((int *)p)[3] = 66;

	LOG("p: '" << ((PRO::int32_t *)p)[3] << "'");

	pSystem->sysMemInfo();

	size = Mem_Free(p);
	
	LOG("size: '" << ((PRO::uint32_t)size) << "'");

	pSystem->sysMemInfo();

	//*/

	pSystem->shutdown();

	LOG("testing completed");

	getchar();
}